1. Field of the Invention
The present invention relates to: an image forming apparatus, i.e., a multi-function peripheral (MFP) such as a multifunctional digital machine; a text data embedding method to be implemented by the image forming apparatus; and a non-transitory computer-readable recording medium storing a program for making a computer of the image forming apparatus implement the text data embedding method.
2. Description of the Related Art
The following description sets forth the inventor's knowledge of related art and problems therein and should not be construed as an admission of knowledge in the prior art.
There has already been an image forming apparatus having the following functions: scanning an image on a document by its scanner; converting the image file into portable document format (PDF); transferring the PDF file to an external apparatus; and storing the PDF file on the image forming apparatus itself.
With this image forming apparatus, users cannot perform a string search unless image files include text data.
Meanwhile, it is common to obtain a text image from a document by a scanner, perform character recognition to convert the text image into text data by a character recognition device, and embed the text data in an image file (for example, Japanese Patents No. 5197694 and No. 4590433). The text data is embedded in a transparent font behind the image file in JPEG format, for example, which allows users to perform a string search.
The character recognition device outputs position information indicating the vertical and horizontal position of each character and the coordinates of characters in each line of text. A position and font size for the text data to be embedded in the image file and others are determined by the position information received therefrom.
In the text data embedding process as described above, there is no limitation on the number of characters in one text string; that is, one text string can be embedded regardless of whether it is composed of only one character or more characters. For a text string to be embedded, a coordinate for the start of the text string, a font size, a horizontal scale factor (scale in the forward and backward reading directions), and other parameters can be specified but a coordinate for the end of the text string cannot be specified. In order to adjust the text string to the corresponding text image in the image file, it is necessary to obtain a horizontal scale factor for the text string. Only if the text string has all characters in a monospaced font, a horizontal length for the text string can be calculated accurately and thus the positions can be adjusted correctly. In contrast, that may not be calculated accurately if the text string has some characters in a proportional font that displays different characters in different widths and is commonly used in ordinary documents. Upon many characters in a proportional font, even a large error in position adjustment can be caused by an inaccurate horizontal scale factor being obtained.
To solve this problem, there suggested are some methods of splitting a text string obtained from each line of text, into a plurality of short text strings and adjusting each short text string to the corresponding text image, which aims to prevent an error in adjustment of horizontal position. These suggested methods are for example: (1) splitting a text string into a plurality of individual characters and adjusting each character to the corresponding text image; and (2) splitting a text string into a plurality of short text strings at every separator such as a comma, dot, or space and adjusting each short text string to the corresponding text image.
However, these conventional methods, which aim to prevent an error in position adjustment, still have an outstanding problem as described below.
In these conventional methods, after character recognition, a font size for each character to be embedded in the image file is determined by calculating the height of each character from its vertical coordinate; accordingly, when the text string is split into a plurality of short text strings, a font size for each short text string is determined on the basis of the heights of characters in each short text string.
For example, when the text string “well over a million” is split into the four short text strings, “well”, “over”, “a”, and “million”, a small font size is determined for the short text strings “over” and “a” both being composed of only characters whose height is small and a large font size is determined for the short text strings “well” and “million” both including some characters whose height is great.
FIGS. 2A, 2B, 2C, and 2D are explanatory views of an image file having a text string, which is composed of short text strings whose font sizes are determined as described above.
FIG. 2A illustrates a text image 100 displayed in a hollow manner. FIG. 2B illustrates the text image 100 having the text string 200; it should be understood that the text string 200 is indicated in bold for the sake of convenience but it is actually embedded behind the text image 100 in a transparent manner. The short text strings “over” and “a” have a small font size.
When a user searches this image file for the text string “well over a million”, the relevant short text strings are displayed in an inverted manner as illustrated in FIG. 2C. More specifically, the short text strings are displayed in an inversed manner while having different heights as illustrated in FIG. 2C because the embedded text string is composed of the short text strings having both great and small font sizes and the text areas have different heights. The different heights of the short text strings displayed in an inversed manner negatively affect the legibility, which is not user-friendly.
The description herein of advantages and disadvantages of various features, embodiments, methods, and apparatus disclosed in other publications is in no way intended to limit the present invention. Indeed, certain features of the invention may be capable of overcoming certain disadvantages, while still retaining some or all of the features, embodiments, methods, and apparatus disclosed therein.